package com.glory.brepda.activity.technicalservice;

import android.content.Intent;
import android.os.Bundle;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.glory.brepda.R;
import com.glory.brepda.base.BaseActivity;
import com.glory.brepda.entity.RepairSheetDataEntity;
import com.pda.platform.ui.ui_pdaplatform.view.FreeUI_ClearEditText;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ReplacePartActivity extends BaseActivity {
    @BindView(R.id.tvTitle)
    TextView tvTitle;
    @BindView(R.id.tvBaseSubmit)
    TextView tvBaseSubmit;
    @BindView(R.id.etPartID)
    FreeUI_ClearEditText etPartID;
    @BindView(R.id.etPartName)
    FreeUI_ClearEditText etPartName;
    @BindView(R.id.llMain)
    LinearLayout llMain;
    @BindView(R.id.tvEqp)
    TextView tvEqp;

    @Override
    protected int getLayoutResId() {
        return R.layout.activity_replace_part;
    }

    @Override
    protected void initView() {
        setMainLayout(llMain);
        tvTitle.setText("部件更换");
        String eqpid = getIntent().getStringExtra("EQPID");
        tvEqp.setText(eqpid);
    }

    @Override
    protected void initData() {

    }

    @OnClick(R.id.tvBaseSubmit)
    public void onViewClicked() {
        showSubmitDialog(() -> {
            RepairSheetDataEntity.PartListEntity entity = new RepairSheetDataEntity.PartListEntity();
            entity.setPARTSDESC(getText(etPartName));
            entity.setPARTSID(getText(etPartID));
            Intent intent = new Intent();
            intent.putExtra("PARTENTITY",entity);
            setResult(RESULT_OK,intent);
            finish();
        });

    }
}
